<template>
  <view>
    <view class="inforBox">
      <BaseTitle :title="'基础信息'" :titleRed="true"></BaseTitle>
      <view class="BaseHouseMessage">
        <BaseHouseMessage
          title="楼盘名"
          :content="basics.name"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="房源特色"
          :content="basics.characteristic"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="参考均价"
          :content="basics.unit_price"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="最小参考总价"
          :content="basics.min_price"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="最大参考总价"
          :content="basics.max_price"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="最大参考总价"
          :content="basics.building_type"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="装修"
          :content="basics.decorate"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="产权年限"
          :content="basics.period"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="物业类型"
          :content="basics.property_type"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="开发商"
          :content="basics.developers"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="所在区域"
          :content="basics.street"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="其他"
          :content="basics.brand"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="详细地址"
          :content="basics.address"
          :isBlock="true"
          :nosubstr="false"
        ></BaseHouseMessage>
      </view>
    </view>

    <!-- 销售信息 -->
    <view class="inforBox">
      <BaseTitle :title="'销售信息'" :titleRed="true"></BaseTitle>
      <view class="BaseHouseMessage">
        <BaseHouseMessage
          title="楼盘状态"
          :content="
            sale.sale_status == 1
              ? '售卖'
              : sale.sale_status == 2
              ? '未开盘'
              : '售罄'
          "
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="楼盘处地址"
          :content="sale.sale_office_address"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="规划户数"
          :content="sale.plan_number"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="开盘时间"
          :content="sale.sale_time"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="最近成交日期"
          :content="sale.check_out_time"
          :isBlock="true"
        ></BaseHouseMessage>
      </view>
    </view>

    <!-- 小区 -->
    <view class="inforBox">
      <BaseTitle :title="'小区概括'" :titleRed="true"></BaseTitle>
      <view class="BaseHouseMessage">
        <BaseHouseMessage
          title="占地面积"
          :content="community.floor_area"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="建筑面积"
          :content="community.building_area"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="容积率"
          :content="community.plot_ratio"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="绿化率"
          :content="community.afforest_rate"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="车位"
          :content="community.parking_space"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="车位配比"
          :content="community.parking_space_ratio"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="规划户数"
          :content="community.plan_number"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="物业公司"
          :content="community.property_company"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="供暖"
          :content="community.heating_supply"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="供水类型"
          :content="community.water_supply"
          :isBlock="true"
        ></BaseHouseMessage>
        <BaseHouseMessage
          title="供电类别"
          :content="community.power_supply"
          :isBlock="true"
        ></BaseHouseMessage>
      </view>
    </view>

    <!-- 许可证 -->
    <view class="inforBox">
      <BaseTitle :title="'预售许可证'" :titleRed="true"></BaseTitle>
      <view class="BaseHouseMessage">
        <view v-for="(v, i) in licence" :key="i" class="marginBottom30">
          <BaseHouseMessage
            title="预售证"
            :content="v.name"
            :isBlock="true"
          ></BaseHouseMessage>

          <BaseHouseMessage
            title="发证时间"
            :content="v.dates"
            :isBlock="true"
          ></BaseHouseMessage>
          <BaseHouseMessage
            title="绑定楼栋"
            :content="v.building_info"
            :isBlock="true"
          ></BaseHouseMessage>
        </view>
        <u-empty v-if="licence.length == 0" text="暂未上传预售许可证" mode="list"></u-empty>
      </view>
    </view>
  </view>
</template>

<script>
import BaseTitle from "../../components/BaseTitles/index.vue";
import BaseHouseMessage from "../../components/BaseHouseMessage/index.vue"; //小信息
import { newHouseInfor } from "../../api/api/index";
export default {
  data() {
    return {
      mainActiveIndex: 0,
      activeId: null,

      TabCur: 0,
      scrollLeft: 0,
      tabItem: [
        { title: "基础信息" },
        { title: "销售信息" },
        { title: "小区概括" },
        { title: "预售许可证" },
      ],
      basics: {}, //基础
      sale: {}, //销售信息
      community: {}, //小区
      licence: [], //许可证
    };
  },
  components: {
    BaseTitle,
    BaseHouseMessage,
  },
  onLoad(options) {
    this.id = options.id;
    this.getnewHouseInfor();
  },
  methods: {
    //获取信息vz
    getnewHouseInfor() {
      newHouseInfor({ id:this.id }).then((res) => {
        this.basics = res.data.basics;
        this.sale = res.data.sale;
        this.community = res.data.community;
        this.licence = res.data.licence;
      });
    },
    tabSelect(e) {
      this.TabCur = e.currentTarget.dataset.id;
      this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
    },
  },
};
</script>

<style scoped>
.cu-item {
  color: #5e5e5e !important;
}
.text-green {
  color: #dd282e !important;
  font-size: 30rpx;
  font-weight: bold;
}

.inforBox {
  background: #fff;
}
.BaseHouseMessage {
  padding: 10rpx 30rpx;
  box-sizing: border-box;
}
</style>